package com.towker.core.util;

import javax.servlet.http.HttpServletRequest;

public class GetPath
{

	public static String getWebPath(HttpServletRequest request)
	{
		String.class.getResource("/").toString().replace("WEB-INF/classes/", ""); 
		String path = request.getContextPath();
		return path;
	}
	
	public  void printpath(HttpServletRequest request){
		
//		String ss = request.getSession().getServletContext().getRealPath("/");
//        String path=this.getClass().getResource("/").getPath();//得到d:/tomcat/webapps/工程名WEB-INF/classes/路径
       // path=path.substring(1, path.indexOf("WEB-INF/classes"));//从路径字符串中取出工程路劲
       // System.out.println(System.getProperty("user.dir"));
//       System.out.println(path);
//       System.out.println(ss+"-----");

	}
	

	public static void main(String[] args)
	{
		String result = GetPath.class.getResource("GetPath.class").toString(); 
		System.out.println(result);
		GetPath path = new GetPath();
		//path.printpath(request);
		//System.out.println(String.class.getResource("/").toString().replace("WEB-INF/classes/", "") );
	}
	
}
